﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using r4u.business.logic.layer.ASSESS;

namespace r4u.Controllers
{
    public class RankController : Controller
    {
        [HttpPost]
        public ActionResult Do(Criteria criteria)
        {
            Evaluate eval = new Evaluate();
            Ranking[] ranks = eval.RankApplicants(criteria);

            var settings = new JsonSerializerSettings
            {
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            };

            var jsonResult = new ContentResult
            {
                Content = JsonConvert.SerializeObject(ranks, settings),
                ContentType = "application/json"
            };
            return jsonResult;

        }
    }
}
